<template>
    <div class="double-goods">
        <div class="goods-container">
            <div class="double-hot-sale">
                <div class="double-goods-detail" v-for='(item,index) in content' :key="index">
                    <div class="double-detail-head" @click="toProductDetail(item.id)">
                        <img :src="item['image_url']" alt="">
                        <div class="sale-message">
                            <div class="sales-num">
                                <span>销量{{item['sales_volume']}}</span>
                            </div>
                            <div class="sale-rate">
                                <span>{{item.goods[0].discount}}折</span>
                            </div>
                        </div>
                    </div>
                    <div class="double-detail-name">
                        <span>{{item.name}}</span>
                    </div>
                    <div class="double-detail-price">
                        <div class="now-price">
                            <span>￥</span>
                            <span>{{item.goods[0].price}}</span>
                        </div>
                        <div class="old-price">
                            <span>￥{{item.goods[0]['prime_cost']}}</span>
                        </div>
                        <p>{{item.integral}}积分</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name:'doubleGoods',
    props:['content'],
    data(){
        return {
            
        }
    },
    methods:{
        toProductDetail(id, status, stock){
            this.$router.push({path:'/product', query:{id:id}});
        }
    },
    mounted(){
        this.transferUrl(this.content);
    },
    activated(){
        let loader = this.loading();
        setTimeout(function(){
            loader.close();
        }, 300)
    }
}
</script>

<style lang='less'>
@rem:100rem;

.double-goods{
    width: 100%;
    .goods-container{
        width: 100%;
        .double-hot-sale{
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            .double-goods-detail{
                width: 345/@rem;
                height: 498/@rem;
                margin: 8/@rem 15/@rem;
                box-shadow: 0 2/@rem 6/@rem rgba(0, 0, 0, 0.2);
                .double-detail-head{
                    position: relative;
                    img{
                        width: 345/@rem;
                        height: 345/@rem;
                    }
                    .sale-message{
                        width: 100%;
                        height: 100%;
                        position: absolute;
                        left: 0;
                        top: 0;
                        display: flex;
                        justify-content: flex-end;
                        align-items: flex-end;
                        .sales-num{
                            height: 44/@rem;
                            padding: 0 12/@rem;
                            display: flex;
                            align-items: center;
                            background: rgba(0, 0, 0, 0.6);
                            span{
                                font-size: 24/@rem;
                                color: #fff;
                            }
                        }
                        .sale-rate{
                            height: 44/@rem;
                            padding: 0 12/@rem;
                            display: flex;
                            align-items: center;
                            background: rgba(209,0,22,0.8);
                            span{
                               font-size: 24/@rem;
                               color: #fff; 
                            }
                        }
                    }
                }
                .double-detail-name{
                    width: 100%;
                    padding: 0 8/@rem;
                    box-sizing: border-box;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;
                    text-align: start;
                    margin-top: 12/@rem;
                }
                .double-detail-price{
                    display: flex;
                    align-items: flex-end;
                    margin-top: 12/@rem;
                    padding: 0 8/@rem;
                    .now-price{
                        font-size: 30/@rem;
                        color: #ff2b48;
                        display: flex;
                        align-items: flex-end;
                    }
                    .old-price{
                        font-size: 18/@rem;
                        color: #5b5b5b;
                        text-decoration: line-through;
                        align-items: flex-end;
                        margin-left: 12/@rem;
                    }
                    p{
                        font-size: 18/@rem;
                        color: #5b5b5b;
                        margin-left: 40/@rem;
                    }
                }
            }
        }
    }
}
</style>
